﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MacomberMapSystem.Common.Internals;
using MacomberMapSystem.Common.User_Interfaces.Database;
using WeifenLuo.WinFormsUI.Docking;
using MacomberMapSystem.Common.User_Interfaces.One_Lines;
using MacomberMapSystem.Common.User_Interfaces.Mapping;
using MacomberMapSystem.Common.Database;
using System.Reflection;
using MacomberMapSystem.Common.CIM.Direct;
using MacomberMapSystem.Common.Serialization;
using MacomberMapSystem.Common.Processing;
using MacomberMapSystem.Common.User_Interfaces;

namespace MacomberMapSystem
{
    public partial class frmMain : Form
    {
        #region Variable declarations
        /// <summary>Our UI helper for status displays</summary>
        public MM_UserInterface_Helpers UIHelper;       
        #endregion


        #region Initialization
        /// <summary>
        /// Initialize a new form
        /// </summary>
        public frmMain()
        {
            InitializeComponent();
            UIHelper = new MM_UserInterface_Helpers(ssMain, lblMem, lblCPU, lblThreads,Program.Repository, true);
            if (Environment.CommandLine.IndexOf("/PostProcess", StringComparison.CurrentCultureIgnoreCase) != -1)
                new frmModelMaintenance(Program.Repository, Program.Repository.Model_Collection, Program.Repository.Db).Show(pnlDock, DockState.Document);
            else
            {
                new frmUserAssignments(Program.Repository, Program.Repository.User_Collection).Show(pnlDock, DockState.Document);
                new frmLocateOneLine(Program.Repository, Program.Repository.Model_Collection, Program.Repository.Db).Show(pnlDock, DockState.Document);
                new frmModels(Program.Repository.Model_Collection).Show(pnlDock, DockState.Document);
                new frmModelMaintenance(Program.Repository, Program.Repository.Model_Collection, Program.Repository.Db).Show(pnlDock, DockState.Document);
                new frmModelPosting(Program.Repository.Model_Collection, Program.Repository);
                new frmDirectOneLine(Program.Repository).Show(pnlDock, DockState.Document);
                new frmGISData(Program.Repository).Show(pnlDock, DockState.Document);
                new frmValidateCoordinates(Program.Repository).Show(pnlDock, DockState.Document);
                new frmBlackstartCorridor(Program.Repository, Program.Repository.Model_Collection, Program.Repository.Db).Show(pnlDock, DockState.Document);
                new frmSynchroscopeEditor(Program.Repository, Program.Repository.Model_Collection, Program.Repository.Db).Show(pnlDock, DockState.Document);
                new frmComparer(Program.Repository).Show(pnlDock, DockState.Document);
            }
            this.tmrUpdate.Enabled = true;
            this.tmrUpdate.Interval = 1000;
            this.tmrUpdate.Tick += new System.EventHandler(UIHelper.tmrUpdate_Tick);
            UIHelper.tmrUpdate_Tick(this, EventArgs.Empty);
        }

        #endregion

       
       
    }
}